//
// Created by xili on 2024/8/17 10:21.
// GO BIG OR GO HOME.
//
#include "leetcode.h"

class Solution {
public:
    int minOperations(vector<int> &nums) {
        int n = nums.size();
        int ans = 0;
        for (int i = 1; i < n; i++) {
            if (nums[i] <= nums[i - 1]) {
                ans += nums[i - 1] - nums[i] + 1;
                nums[i] = nums[i - 1] + 1;
            }
        }
        return ans;
    }
};